feat: add interactive prompts for positional arguments#1801
Conversation
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughAdds interactive CLI prompting for missing required flags, optional sentinel-valued flags, and missing positional arguments; registers a new global Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CLI as CLI
participant Parser as StandardFlagParser
participant Viper as Viper/Env
participant Completion as CompletionFunc
participant Prompt as flags.PromptFor*
participant UI as TUI Selector
User->>CLI: run command (missing flags/args)
CLI->>Parser: Parse(cmd, args)
Parser->>Viper: load values from Viper / env
Parser->>Parser: combine flags & initial validation
alt prompts configured && interactive && TTY available
Parser->>Prompt: prompt for missing required / optional-value / positional
Prompt->>Completion: call CompletionFunc(cmd,args,toComplete)
Completion-->>Prompt: options[]
Prompt->>UI: render selector with options
User->>UI: choose option
UI-->>Prompt: selected value
Prompt-->>Parser: inject resolved value
else non-interactive or no options
Parser->>Parser: skip prompts / return ErrInteractiveModeNotAvailable or ErrNoOptionsAvailable
end
Parser->>Parser: final validation
Parser-->>CLI: parsed result or error
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (34)📓 Common learnings📚 Learning: 2025-11-10T03:03:31.505ZApplied to files:
📚 Learning: 2025-12-13T00:52:18.278ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-12-13T04:37:40.435ZApplied to files:
📚 Learning: 2025-12-13T00:52:18.278ZApplied to files:
📚 Learning: 2024-10-23T21:36:40.262ZApplied to files:
📚 Learning: 2025-09-13T18:06:07.674ZApplied to files:
📚 Learning: 2025-10-22T14:55:44.014ZApplied to files:
📚 Learning: 2025-01-30T19:30:59.120ZApplied to files:
📚 Learning: 2025-08-16T23:33:07.477ZApplied to files:
📚 Learning: 2025-12-13T03:21:27.620ZApplied to files:
📚 Learning: 2025-08-16T23:32:40.412ZApplied to files:
📚 Learning: 2025-08-15T14:43:41.030ZApplied to files:
📚 Learning: 2025-11-11T03:47:59.576ZApplied to files:
📚 Learning: 2025-02-18T13:18:53.146ZApplied to files:
📚 Learning: 2025-02-09T14:38:53.443ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-12-13T00:52:18.278ZApplied to files:
📚 Learning: 2025-02-07T19:21:38.028ZApplied to files:
📚 Learning: 2024-12-07T16:19:01.683ZApplied to files:
📚 Learning: 2025-12-13T06:10:06.715ZApplied to files:
📚 Learning: 2024-11-16T17:30:52.893ZApplied to files:
📚 Learning: 2025-06-07T19:28:21.289ZApplied to files:
📚 Learning: 2025-10-10T23:51:36.597ZApplied to files:
📚 Learning: 2025-01-07T20:38:09.618ZApplied to files:
📚 Learning: 2024-10-31T19:25:41.298ZApplied to files:
📚 Learning: 2025-01-09T22:37:01.004ZApplied to files:
📚 Learning: 2025-01-09T22:27:25.538ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-02-07T19:21:38.028ZApplied to files:
📚 Learning: 2025-05-22T19:58:32.988ZApplied to files:
🧬 Code graph analysis (1)pkg/flags/standard_test.go (2)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (5)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 WalkthroughWalkthroughThis PR introduces interactive prompting capabilities to Atmos CLI. It adds prompt utilities for missing required flags and positional arguments, integrates prompts into the StandardFlagParser, extends the global flag structure with an Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as Command Parser
participant InteractivePrompts as Interactive Module
participant Huh as Prompt UI (Huh)
participant ThemeSystem as Theme System
User->>CLI: Execute command (e.g., `show`)
CLI->>CLI: RegisterFlags & Validators<br/>(with prompt config)
CLI->>CLI: Parse arguments
Note over CLI: Check for prompts<br/>in standardFlagParser.Parse()
CLI->>InteractivePrompts: handleInteractivePrompts()
alt Interactive Mode Enabled & TTY & Not CI
InteractivePrompts->>InteractivePrompts: Check for missing<br/>required flags/args
opt Missing required flag or arg detected
InteractivePrompts->>InteractivePrompts: Call CompletionFunc<br/>(get options)
InteractivePrompts->>InteractivePrompts: PromptForValue()
InteractivePrompts->>ThemeSystem: GetCurrentStyles()
ThemeSystem-->>InteractivePrompts: Interactive colors
InteractivePrompts->>Huh: Display select prompt<br/>with theme colors
Huh-->>User: Show themed menu
User->>Huh: Select option
Huh-->>InteractivePrompts: Return selection
end
InteractivePrompts-->>CLI: Resolved flag/arg value
else Non-Interactive Mode
InteractivePrompts-->>CLI: Nil (defer to Cobra<br/>validation/error)
end
CLI->>CLI: Validate & bind flags
CLI->>CLI: Execute command logic
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Areas requiring extra attention:
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
pkg/flags/interactive_test.go (1)
280-306: StandardFlagParser positional prompt test is failing for the same non-interactive error propagationIn
"skips prompt when not interactive",promptForMissingPositionalArgscallsPromptForPositionalArg, which currently bubblesErrInteractiveModeNotAvailablewheninteractiveis false. That contradicts the test’s expectation ofNoErrorand matches the second pipeline failure.Once
PromptForPositionalArgis updated to return""andnilin non-interactive mode (as suggested in the other comment), this test will behave as intended: no prompt, no error, andPositionalArgsleft unchanged.No change needed in this test; it’s correctly capturing the desired degradation behavior.
🧹 Nitpick comments (7)
pkg/flags/global_builder.go (1)
103-106: Broaden interactive flag help text to match actual behaviorThe
--interactiveflag now covers missing required flags, optional value flags (sentinel pattern), and positional args. The current description only mentions missing required flags, which can under-sell the feature.Consider updating the description to reflect all prompt types, e.g.:
- b.options = append(b.options, WithBoolFlag("interactive", "", defaults.Interactive, "Enable interactive prompts for missing required flags (requires TTY, disabled in CI)")) + b.options = append(b.options, WithBoolFlag("interactive", "", defaults.Interactive, "Enable interactive prompts (required flags, optional values, positional args; requires TTY, disabled in CI)"))pkg/flags/global/flags.go (1)
43-47: Align Interactive field comment with full prompt behaviorThe
Interactiveflag drives prompts for required flags, optional value flags, and positional args, but the struct comment only mentions missing required flags.To keep docs consistent and avoid confusion later, consider:
- Interactive bool // Enable interactive prompts for missing required flags (--interactive). + Interactive bool // Enable interactive prompts for flags and positional args (--interactive).The default
Interactive: trueand placement next to other terminal knobs look good.Also applies to: 78-86
internal/tui/utils/utils.go (1)
19-20: Guard against nil styles in NewAtmosHuhThemeThe theme-driven styling is a nice improvement, but
theme.GetCurrentStyles()is assumed non-nil. If style initialization ever fails, dereferencingstyles.Interactivewill panic.A small guard keeps prompts robust:
func NewAtmosHuhTheme() *huh.Theme { t := huh.ThemeCharm() - // Get current theme styles for consistent colors. - styles := theme.GetCurrentStyles() + // Get current theme styles for consistent colors. + styles := theme.GetCurrentStyles() + if styles == nil { + // Fall back to the base Charm theme if styles cannot be loaded. + return t + } // Extract colors from theme for interactive elements. buttonForeground := styles.Interactive.ButtonForeground.GetForeground() buttonBackground := styles.Interactive.ButtonBackground.GetBackground() primaryColor := styles.Selected.GetForeground()This preserves behavior when styles are available while avoiding hard crashes if the theme system fails.
Also applies to: 97-117
.claude/agents/flag-handler.md (1)
386-545: Keep parser constructor name consistent in examplesThe new interactive prompts section is thorough, but the example uses
flags.NewStandardFlagParser(...)while earlier sections talk aboutflags.NewStandardParser(...). If only one of these actually exists inpkg/flags/, this mismatch will be confusing when people copy code from the agent doc.Worth double-checking the real constructor name and aligning all examples (here and in other docs) to that single API to avoid drift.
Also applies to: 561-562
cmd/theme/show.go (1)
17-33: Theme completion helper is correct; prefix filtering is optionalThemesArgCompletion loads the registry once, returns all theme names, and degrades gracefully by disabling completion if the registry can’t be built. That’s a reasonable behavior for shell completion.
If the number of themes grows large, you could optionally filter the names slice by the toComplete prefix to reduce noise, but it’s not required for correctness.
pkg/flags/options.go (1)
23-36: Interactive prompt configuration is cleanly integrated; note ordering expectations for optional-value prompts
- Adding flagPrompts, optionalValuePrompts, and positionalPrompts on parserConfig, backed by flagPromptConfig, centralizes prompt metadata without complicating the flag types themselves.
- WithCompletionPrompt and WithPositionalArgPrompt simply populate those maps, which keeps the behavior driven by the parsing/interactive layers and looks straightforward.
- WithOptionalValuePrompt:
- Reuses cfg.IdentityFlagSelectValue as the NoOptDefVal sentinel, which is consistent with the existing
--identitypattern.- Then stores the prompt config under optionalValuePrompts so the interactive layer can detect the sentinel and launch the selector.
One nuance: WithOptionalValuePrompt assumes the named flag is already registered in cfg.registry (same ordering requirement as WithEnvVars and WithNoOptDefVal). If someone accidentally calls it before the corresponding WithStringFlag/WithXxxFlag, the prompt config will still be stored but NoOptDefVal won’t be set. If you want stronger guardrails, you could mirror WithEnvVars’ behavior and early-return when c.registry.Get(flagName) is nil.
Also applies to: 326-418
pkg/flags/standard.go (1)
533-555: Positional validation is skipped whenever prompts exist, even when interactive mode is unavailable
validatePositionalArgsnow bypasses the configured validator whenever anypositionalPromptsentry exists:hasPrompts := false for _, spec := range p.positionalArgs.specs { if _, exists := p.positionalPrompts[spec.Name]; exists { hasPrompts = true break } } if !hasPrompts { if err := p.positionalArgs.validator(p.cmd, positionalArgs); err != nil { return err } } // if prompts configured, validation is always skippedThat means in non-interactive contexts (no TTY / CI /
--interactive=false), commands with positional prompts may no longer get validation fromParse, even though prompts will never fire. Cobra’sArgsvalidator may cover the CLI path, but any programmatic uses ofStandardFlagParser.Parse(or tests) will silently accept missing required args.Suggest tightening this to only skip validation when both prompts exist and interactive mode is actually available:
- if !hasPrompts { - // No prompts configured, use standard validation - if err := p.positionalArgs.validator(p.cmd, positionalArgs); err != nil { - return err - } - } - // If prompts configured, skip validation - prompts will handle it + // If prompts are not configured, or interactive mode is unavailable, + // fall back to the original validator. + if !hasPrompts || !isInteractive() { + if err := p.positionalArgs.validator(p.cmd, positionalArgs); err != nil { + return err + } + } + // When prompts are configured and interactive mode is available, + // skip this validator and let interactive prompts fill missing values.This keeps the interactive prompt behavior while preserving validation guarantees in non-interactive flows.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
.claude/agents/flag-handler.md(2 hunks)cmd/theme/show.go(3 hunks)cmd/theme/theme_test.go(2 hunks)docs/developing-atmos-commands.md(1 hunks)errors/errors.go(1 hunks)internal/tui/utils/utils.go(2 hunks)pkg/flags/global/flags.go(2 hunks)pkg/flags/global_builder.go(1 hunks)pkg/flags/interactive.go(1 hunks)pkg/flags/interactive_test.go(1 hunks)pkg/flags/options.go(3 hunks)pkg/flags/positional_args_builder.go(2 hunks)pkg/flags/standard.go(8 hunks)pkg/flags/types.go(1 hunks)pkg/ui/theme/scheme.go(2 hunks)pkg/ui/theme/styles.go(3 hunks)
🧰 Additional context used
🧠 Learnings (46)
📓 Common learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.217Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.godocs/developing-atmos-commands.md
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
.claude/agents/flag-handler.mdcmd/theme/show.gopkg/flags/global_builder.gopkg/flags/interactive.godocs/developing-atmos-commands.md
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.godocs/developing-atmos-commands.mdpkg/flags/options.go
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.go
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.gopkg/flags/global/flags.godocs/developing-atmos-commands.md
📚 Learning: 2024-11-16T17:30:52.893Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/interactive.godocs/developing-atmos-commands.mdpkg/flags/standard.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/options.go
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.gopkg/flags/global/flags.gopkg/flags/options.go
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global_builder.gopkg/flags/interactive.godocs/developing-atmos-commands.md
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
.claude/agents/flag-handler.mddocs/developing-atmos-commands.mdpkg/flags/standard.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
.claude/agents/flag-handler.mdcmd/theme/show.gopkg/flags/global_builder.gopkg/flags/interactive.gocmd/theme/theme_test.godocs/developing-atmos-commands.mdpkg/flags/options.go
📚 Learning: 2024-12-12T17:13:53.409Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 848
File: pkg/utils/doc_utils.go:19-22
Timestamp: 2024-12-12T17:13:53.409Z
Learning: In `pkg/utils/doc_utils.go`, the `DisplayDocs` function uses the `PAGER` environment variable, which is intentionally user-configurable to allow users to specify custom pager commands that fit their workflow; adding validation to restrict it is not desired.
Applied to files:
.claude/agents/flag-handler.md
📚 Learning: 2024-11-10T18:37:10.032Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_component_utils.go:354-360
Timestamp: 2024-11-10T18:37:10.032Z
Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.
Applied to files:
.claude/agents/flag-handler.mdpkg/flags/global/flags.go
📚 Learning: 2024-10-31T19:25:41.298Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:233-235
Timestamp: 2024-10-31T19:25:41.298Z
Learning: When specifying color values in functions like `confirmDeleteTerraformLocal` in `internal/exec/terraform_clean.go`, avoid hardcoding color values. Instead, use predefined color constants or allow customization through configuration settings to improve accessibility and user experience across different terminals and themes.
Applied to files:
cmd/theme/show.gointernal/tui/utils/utils.gopkg/flags/global/flags.gopkg/ui/theme/scheme.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
cmd/theme/show.gopkg/flags/standard.go
📚 Learning: 2025-01-30T19:30:59.120Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.
Applied to files:
cmd/theme/show.godocs/developing-atmos-commands.md
📚 Learning: 2024-12-05T22:33:40.955Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 820
File: cmd/list_components.go:53-54
Timestamp: 2024-12-05T22:33:40.955Z
Learning: In the Atmos CLI Go codebase, using `u.LogErrorAndExit` within completion functions is acceptable because it logs the error and exits the command execution.
Applied to files:
cmd/theme/show.gopkg/flags/types.go
📚 Learning: 2025-02-03T06:00:11.419Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.
Applied to files:
errors/errors.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/tui/utils/utils.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
internal/tui/utils/utils.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
pkg/flags/positional_args_builder.gopkg/flags/types.gopkg/flags/interactive.gopkg/flags/interactive_test.gopkg/flags/standard.gopkg/flags/options.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method (as of cobra v1.8.1) never returns an error. It only initializes an internal map and stores the completion function, always returning nil. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/types.gopkg/flags/interactive_test.gopkg/flags/standard.gopkg/flags/options.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method never returns an error as it simply stores the completion function in an internal map. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/types.gopkg/flags/standard.gopkg/flags/options.go
📚 Learning: 2025-02-09T14:38:53.443Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/cmd_utils.go:0-0
Timestamp: 2025-02-09T14:38:53.443Z
Learning: Error handling for RegisterFlagCompletionFunc in AddStackCompletion is not required as the errors are non-critical for tab completion functionality.
Applied to files:
pkg/flags/types.gopkg/flags/interactive_test.gopkg/flags/options.go
📚 Learning: 2025-09-29T02:20:11.636Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/validate_component.go:117-118
Timestamp: 2025-09-29T02:20:11.636Z
Learning: The ValidateComponent function in internal/exec/validate_component.go had its componentSection parameter type refined from `any` to `map[string]any` without adding new parameters. This is a type safety improvement, not a signature change requiring call site updates.
Applied to files:
pkg/flags/types.go
📚 Learning: 2024-10-21T17:51:07.087Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform.go:114-118
Timestamp: 2024-10-21T17:51:07.087Z
Learning: Use `bubbletea` for confirmation prompts instead of `fmt.Scanln` in the `atmos terraform clean` command.
Applied to files:
pkg/flags/global_builder.go
📚 Learning: 2025-11-10T03:03:31.505Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 0
File: :0-0
Timestamp: 2025-11-10T03:03:31.505Z
Learning: In the Atmos codebase, commands using the `StandardParser` flag pattern (from pkg/flags) do NOT need explicit `viper.BindPFlag()` calls in their code. The StandardParser encapsulates flag binding internally: flags are registered via `parser.RegisterFlags(cmd)` in init(), and bound via `parser.BindFlagsToViper(cmd, v)` in RunE, which internally calls viper.BindPFlag for each flag. This pattern is used throughout Atmos (e.g., cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/path.go). Do not flag missing viper.BindPFlag calls when StandardParser is used.
Applied to files:
pkg/flags/interactive.gopkg/flags/interactive_test.gopkg/flags/standard.go
📚 Learning: 2025-06-07T19:28:21.289Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-01-18T15:18:35.475Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Applied to files:
cmd/theme/theme_test.go
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-11-07T14:52:55.217Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.217Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-05-22T19:58:32.988Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected.go:122-123
Timestamp: 2025-05-22T19:58:32.988Z
Learning: The "pager" flag is defined as a PersistentFlag at the describe command level in cmd/describe.go, making it available to all subcommands including describeAffectedCmd without needing to redeclare it.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-10-13T18:13:54.020Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1622
File: pkg/perf/perf.go:140-184
Timestamp: 2025-10-13T18:13:54.020Z
Learning: In pkg/perf/perf.go, the `trackWithSimpleStack` function intentionally skips ownership checks at call stack depth > 1 to avoid expensive `getGoroutineID()` calls on every nested function. This is a performance optimization for the common single-goroutine execution case (most Atmos commands), accepting the rare edge case of potential metric corruption if multi-goroutine execution occurs at depth > 1. The ~19× performance improvement justifies this trade-off.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-08-16T23:33:07.477Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:651-652
Timestamp: 2025-08-16T23:33:07.477Z
Learning: In the cloudposse/atmos Go codebase, ExecuteDescribeDependents expects a pointer to AtmosConfiguration (*schema.AtmosConfiguration), so when calling it with a value returned by cfg.InitCliConfig (which returns schema.AtmosConfiguration), the address-of operator (&) is necessary: ExecuteDescribeDependents(&atmosConfig, ...).
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-08-16T23:32:40.412Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:455-456
Timestamp: 2025-08-16T23:32:40.412Z
Learning: In the cloudposse/atmos Go codebase, `InitCliConfig` returns a `schema.AtmosConfiguration` value (not a pointer), while `ExecuteDescribeDependents` expects a `*schema.AtmosConfiguration` pointer parameter. Therefore, when passing the result of `InitCliConfig` to `ExecuteDescribeDependents`, use `&atmosConfig` to pass the address of the value.
Applied to files:
pkg/flags/options.go
🧬 Code graph analysis (9)
cmd/theme/show.go (7)
pkg/perf/perf.go (1)
Track(121-138)pkg/ui/theme/registry.go (1)
NewRegistry(22-47)pkg/flags/positional_args_builder.go (2)
NewPositionalArgsBuilder(57-63)PositionalArgSpec(24-31)errors/builder.go (1)
Build(21-23)pkg/flags/standard.go (1)
NewStandardFlagParser(60-84)pkg/flags/options.go (1)
WithPositionalArgPrompt(406-418)errors/errors.go (1)
ErrInvalidPositionalArgs(72-72)
internal/tui/utils/utils.go (2)
pkg/ui/theme/theme.go (1)
Theme(33-56)pkg/ui/theme/styles.go (1)
GetCurrentStyles(348-373)
pkg/flags/positional_args_builder.go (2)
pkg/flags/types.go (1)
CompletionFunc(21-21)pkg/perf/perf.go (1)
Track(121-138)
pkg/flags/global_builder.go (1)
pkg/flags/options.go (2)
WithBoolFlag(63-74)WithEnvVars(233-256)
pkg/flags/interactive.go (6)
pkg/perf/perf.go (1)
Track(121-138)internal/tui/templates/term/term_writer.go (1)
IsTTYSupportForStdin(133-135)pkg/telemetry/ci.go (1)
IsCI(81-86)errors/errors.go (2)
ErrInteractiveModeNotAvailable(543-543)ErrNoOptionsAvailable(544-544)internal/tui/utils/utils.go (1)
NewAtmosHuhTheme(99-118)pkg/flags/types.go (1)
CompletionFunc(21-21)
pkg/ui/theme/styles.go (1)
pkg/ui/theme/scheme.go (1)
ColorScheme(7-54)
pkg/flags/interactive_test.go (6)
pkg/flags/parser.go (1)
ParsedConfig(68-90)pkg/flags/interactive.go (4)
PromptForValue(45-77)PromptForMissingRequired(88-102)PromptForOptionalValue(120-139)PromptForPositionalArg(151-163)pkg/flags/standard.go (1)
NewStandardFlagParser(60-84)pkg/flags/options.go (3)
WithOptionalValuePrompt(367-386)WithCompletionPrompt(337-349)WithPositionalArgPrompt(406-418)pkg/flags/positional_args_builder.go (2)
NewPositionalArgsBuilder(57-63)PositionalArgSpec(24-31)pkg/flags/types.go (1)
CompletionFunc(21-21)
pkg/flags/standard.go (6)
pkg/flags/registry.go (2)
FlagRegistry(17-19)NewFlagRegistry(22-28)pkg/flags/positional_args_builder.go (1)
NewPositionalArgsBuilder(57-63)pkg/flags/parser.go (1)
ParsedConfig(68-90)pkg/config/const.go (1)
IdentityFlagSelectValue(136-136)pkg/flags/interactive.go (3)
PromptForOptionalValue(120-139)PromptForMissingRequired(88-102)PromptForPositionalArg(151-163)pkg/flags/types.go (1)
CompletionFunc(21-21)
pkg/flags/options.go (3)
pkg/flags/types.go (2)
CompletionFunc(21-21)StringFlag(53-62)pkg/perf/perf.go (1)
Track(121-138)pkg/config/const.go (1)
IdentityFlagSelectValue(136-136)
🪛 GitHub Actions: Tests
pkg/flags/interactive_test.go
[error] 137-137: interactive mode not available
[error] 304-304: interactive mode not available
🪛 LanguageTool
docs/developing-atmos-commands.md
[typographical] ~873-~873: Consider using typographic quotation marks here.
Context: ...) - atmos cmd --identity=admin → Uses "admin" directly - atmos cmd → Uses empty/def...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic opening quote here.
Context: ... 2. Use descriptive prompt titles - "Choose a theme to preview" not "Select t...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic close quote here.
Context: ...pt titles** - "Choose a theme to preview" not "Select theme" 3. **Handle empty re...
(EN_QUOTES)
[typographical] ~958-~958: Consider using typographic quotation marks here.
Context: ...les** - "Choose a theme to preview" not "Select theme" 3. Handle empty results gracefully ...
(EN_QUOTES)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (9)
pkg/flags/types.go (1)
9-21: CompletionFunc alias and docs look solidThe
CompletionFuncalias cleanly mirrors Cobra’sValidArgsFunctionand the doc block makes its dual role (shell completion + interactive prompts) clear. No changes needed here.errors/errors.go (1)
543-545: Interactive sentinel errors are appropriately scopedThe new
ErrInteractiveModeNotAvailableandErrNoOptionsAvailablesentinels are well named and will make it easier to branch on interactive-specific failure modes without string matching. No changes needed here.cmd/theme/theme_test.go (1)
38-44: Tests capture prompt-aware zero-arg behavior fortheme showUpdating the
Usestring toshow <theme-name>and asserting thatArgsaccepts zero or one argument (while rejecting more than one) lines up with the interactive positional-arg prompt design and keeps behavior well documented in tests. Looks good.Also applies to: 112-130
pkg/ui/theme/styles.go (1)
72-76: Interactive button styles wiring looks solidThe Interactive styles cleanly derive button foreground/background from the ColorScheme via getInteractiveStyles, keeping prompts theme-aware without introducing new hard-coded colors. I don’t see any functional issues here.
Also applies to: 154-156, 249-260
pkg/ui/theme/scheme.go (1)
42-45: Interactive color fields are consistent with existing themingButtonForeground and ButtonBackground are sourced from the Theme palette (t.BrightWhite / t.BrightBlue), matching the rest of ColorScheme and avoiding inline hex values. This keeps interactive elements configurable per theme.
Also applies to: 104-107
cmd/theme/show.go (2)
48-77: Positional arg builder + prompt configuration fortheme-namehangs together wellThe init wiring looks coherent:
- PositionalArgsBuilder defines a single required arg
theme-namemapped to ThemeShowOptions.ThemeName.- WithPositionalArgPrompt uses the same arg name and ThemesArgCompletion, so both prompting and completion share one source of truth.
- SetPositionalArgs and the dynamic
themeShowCmd.Use = "show " + usagekeep help/usage text in sync with the positional spec.This matches the PR goal of making
atmos theme showwork interactively when the theme name is omitted.
100-118: Parse + positional error handling covers fallback when prompts can’t supply a themeUsing themeShowParser.Parse to resolve both flags and positional args lets the interactive layer fill in ThemeName when possible. The explicit
len(parsed.PositionalArgs) == 0check with ErrInvalidPositionalArgs (plus clear hints) provides a good fallback when no theme-name is ultimately resolved (e.g., non-interactive or aborted). The mapping into ThemeShowOptions viaparsed.PositionalArgs[0]is safe given the preceding length check.pkg/flags/positional_args_builder.go (1)
17-31: The edge cases are already handled correctly—no changes neededThe implementation actually manages both concerns well:
Empty specs with hasPrompts: If
len(b.specs) == 0, the validator correctly allows 0 args and rejects any (which is proper—nothing to prompt for). No special-casing needed.Future generateValidator consistency: Already defended. The prompt-aware path calls
standardValidatorwhen all args are present, preserving required/optional semantics by design.The wiring is confirmed working at
pkg/flags/standard.go:186. The code is thoughtfully designed and doesn't require modifications for these edge cases.pkg/flags/standard.go (1)
784-807: Interactive prompts orchestration order looks good and is defensive with nilcombinedFlagsThe
handleInteractivePromptsflow (optional value → missing required flags → missing positional args) is sensible and aligns with the three use cases. Each helper checks forcombinedFlags == nilor empty prompt maps before doing work, so calling it from tests withcombinedFlagsset tonilis safe.Once
PromptForPositionalArgshort-circuits on!isInteractive(), this helper will also gracefully no-op in non-interactive environments while still handling interactive TTY flows correctly.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (7)
pkg/flags/positional_args_builder.go (1)
17-31: Prompt-aware validator behavior is solid; consider guarding the zero-spec edge.The new
PositionalArgSpecfields andGeneratePromptAwareValidatordesign nicely solve the Cobra timing issue by relaxing required checks untilParse()can run prompts. One small edge-case: ifhasPromptsis true andlen(b.specs) == 0, the current closure would reject any args (totalCount == 0), whereasgenerateValidator()alone would usecobra.ArbitraryArgs. You probably never call this with zero specs, but adding a guard to fall back tostandardValidatorwhenlen(b.specs) == 0would make the helper safer for future use.func (b *PositionalArgsBuilder) GeneratePromptAwareValidator(hasPrompts bool) cobra.PositionalArgs { defer perf.Track(nil, "flags.PositionalArgsBuilder.GeneratePromptAwareValidator")() // Get the standard validator standardValidator := b.generateValidator() - // If no prompts configured, use standard validator - if !hasPrompts { + // If no prompts configured or no specs, use standard validator + if !hasPrompts || len(b.specs) == 0 { return standardValidator }Also applies to: 143-174, 176-228
.claude/agents/flag-handler.md (1)
386-545: Interactive prompts doc is slightly out of sync with current patterns.The new section is helpful, but a couple of details now diverge from the implementation:
- In the optional value example,
WithOptionalValuePromptalready setsNoOptDefValto the sentinel (cfg.IdentityFlagSelectValue), so the manualNoOptDefVal = "__SELECT__"line is redundant and could get out of sync with the actual sentinel value.- In the
atmos theme showexample, the snippet still setsthemeShowCmd.Args = validator, whilecmd/theme/show.gonow relies on the flag handler to install a prompt-awareArgsvalidator automatically when positional prompts are configured. Updating the example (and comments) to match that pattern will keep future guidance aligned with the real code path.These are doc-level tweaks but worth fixing so the agent keeps steering people toward the new, prompt-aware flow.
Based on learnings
Also applies to: 551-562
pkg/flags/interactive_test.go (1)
50-54: Small test cleanups for clarity and future-proofing.A few minor nits in these tests:
- The “no options available” subtests for
PromptForValueandPromptForMissingRequiredrun withinteractive=false, so they never actually exercise the “no options” branch in the helpers; they only verify that an error/empty result occurs. That’s acceptable for now but worth a comment so future readers don’t over-interpret what’s being validated.- The sentinel
"__SELECT__"is hardcoded here, while the implementation uses a shared constant (cfg.IdentityFlagSelectValue). Importing that constant in tests (if dependency boundaries allow) would avoid drift if the sentinel ever changes.These are low-priority, but tightening them later would make the tests more explicit and robust.
Also applies to: 79-87, 105-117, 164-177, 186-194
pkg/flags/options.go (1)
351-386: Ordering assumptions and non-interactive behavior for optional-value prompts
WithOptionalValuePromptassumes the target string flag is already in the registry when this option runs; otherwisec.registry.Get(flagName)is nil and the sentinel never gets set. In practice you’re calling these in the right order, but it might be worth either documenting the ordering requirement in the comments or adding a small guard/log for the missing-flag case so mis-ordering is easier to spot.Also, when interactive mode is unavailable, the sentinel
IdentityFlagSelectValueis preserved (no prompt) and later validation may treat it as an invalid value ifWithValidValuesis used on the same flag. That’s a reasonable choice, but it effectively makes--flagwithout a value invalid in non-interactive contexts. Please double-check this matches the intended UX for CI/pipeline runs.pkg/flags/interactive.go (1)
104-139: Optional-value prompt behavior is sensible but worth documentingThe
PromptForOptionalValueflow is clear:
- Only sentinel values trigger a prompt.
- Non-interactive environments and empty completion sets quietly fall back by returning
"", letting callers decide how to treat the sentinel.Given StandardFlagParser currently treats an empty
selectedValueas “keep sentinel,” it might be worth calling out in comments (here or on the option helper) that using--flagwithout a value in non-interactive environments will not auto-resolve to the default and may surface as an invalid value if validation is configured. That’s subtle but important UX.pkg/flags/standard.go (2)
116-188: Positional args validator hook relies on setup order—worth double-checking
RegisterFlagscallingregisterPositionalArgsValidatoris a good place to inject the prompt-aware validator, andregisterPositionalArgsValidatoritself cleanly rebuilds the validator viaPositionalArgsBuilder.One subtle dependency: this assumes
SetPositionalArgshas been called beforeRegisterFlagssop.positionalArgsand its specs are available. Given the comments referenceStandardOptionsBuilder, this is probably true today, but it would be good to confirm the builder always wires things in that order (or document the expectation) so future commands don’t accidentally miss out on the prompt-aware behavior.
809-855: Optional-value wiring matches helper semantics but may surprise in non-interactive mode
promptForOptionalValueFlagscorrectly:
- Filters only flags configured for optional-value prompts.
- Uses the sentinel check before calling
PromptForOptionalValue.- Updates
result.Flagsonly when a non-empty selection is returned.However, when
PromptForOptionalValuereturns""because interactive mode isn’t available or no options exist, this helper intentionally keeps the sentinel value inresult.Flags. Combined withvalidateFlagValues, that can make syntactically valid CLI like--flagwithout a value fail validation in non-interactive contexts ifWithValidValuesis configured.If the intended UX is “
--flagwithout value is only supported when interactive prompts can run,” this is fine; otherwise, consider mapping the sentinel back to the flag’s default (or treating it as “unset”) in the non-interactive path.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
.claude/agents/flag-handler.md(2 hunks)cmd/theme/show.go(3 hunks)cmd/theme/theme_test.go(2 hunks)docs/developing-atmos-commands.md(1 hunks)errors/errors.go(1 hunks)internal/tui/utils/utils.go(2 hunks)pkg/flags/global/flags.go(2 hunks)pkg/flags/global_builder.go(1 hunks)pkg/flags/interactive.go(1 hunks)pkg/flags/interactive_test.go(1 hunks)pkg/flags/options.go(3 hunks)pkg/flags/positional_args_builder.go(2 hunks)pkg/flags/standard.go(8 hunks)pkg/flags/types.go(1 hunks)pkg/ui/theme/scheme.go(2 hunks)pkg/ui/theme/styles.go(3 hunks)
🧰 Additional context used
🧠 Learnings (44)
📓 Common learnings
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
📚 Learning: 2025-02-03T06:00:11.419Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.
Applied to files:
errors/errors.go
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
pkg/flags/global_builder.gopkg/flags/options.gopkg/flags/interactive.godocs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
pkg/flags/global_builder.gopkg/flags/global/flags.gopkg/flags/options.gopkg/flags/interactive.godocs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
pkg/flags/global_builder.gopkg/flags/global/flags.gopkg/flags/options.gopkg/flags/interactive.go.claude/agents/flag-handler.md
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
pkg/flags/global_builder.gocmd/theme/show.gopkg/flags/options.gopkg/flags/interactive.godocs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
pkg/flags/global_builder.gopkg/flags/options.gopkg/flags/interactive.go.claude/agents/flag-handler.md
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
pkg/flags/global_builder.gopkg/flags/options.gopkg/flags/interactive.go.claude/agents/flag-handler.md
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
pkg/flags/global_builder.go.claude/agents/flag-handler.md
📚 Learning: 2024-10-31T19:25:41.298Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:233-235
Timestamp: 2024-10-31T19:25:41.298Z
Learning: When specifying color values in functions like `confirmDeleteTerraformLocal` in `internal/exec/terraform_clean.go`, avoid hardcoding color values. Instead, use predefined color constants or allow customization through configuration settings to improve accessibility and user experience across different terminals and themes.
Applied to files:
pkg/flags/global_builder.gopkg/flags/global/flags.gointernal/tui/utils/utils.gopkg/ui/theme/scheme.go
📚 Learning: 2024-10-21T17:51:07.087Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform.go:114-118
Timestamp: 2024-10-21T17:51:07.087Z
Learning: Use `bubbletea` for confirmation prompts instead of `fmt.Scanln` in the `atmos terraform clean` command.
Applied to files:
pkg/flags/global_builder.go
📚 Learning: 2024-11-10T18:37:10.032Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_component_utils.go:354-360
Timestamp: 2024-11-10T18:37:10.032Z
Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.
Applied to files:
pkg/flags/global/flags.gopkg/flags/interactive.go.claude/agents/flag-handler.md
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method (as of cobra v1.8.1) never returns an error. It only initializes an internal map and stores the completion function, always returning nil. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/types.gopkg/flags/interactive_test.gopkg/flags/options.gopkg/flags/standard.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
pkg/flags/types.gopkg/flags/interactive_test.gopkg/flags/positional_args_builder.gopkg/flags/options.gopkg/flags/standard.gopkg/flags/interactive.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method never returns an error as it simply stores the completion function in an internal map. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/types.gopkg/flags/options.gopkg/flags/standard.go
📚 Learning: 2025-02-09T14:38:53.443Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/cmd_utils.go:0-0
Timestamp: 2025-02-09T14:38:53.443Z
Learning: Error handling for RegisterFlagCompletionFunc in AddStackCompletion is not required as the errors are non-critical for tab completion functionality.
Applied to files:
pkg/flags/types.gopkg/flags/interactive_test.gopkg/flags/options.go
📚 Learning: 2024-12-05T22:33:40.955Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 820
File: cmd/list_components.go:53-54
Timestamp: 2024-12-05T22:33:40.955Z
Learning: In the Atmos CLI Go codebase, using `u.LogErrorAndExit` within completion functions is acceptable because it logs the error and exits the command execution.
Applied to files:
pkg/flags/types.gocmd/theme/show.go
📚 Learning: 2025-01-30T19:30:59.120Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.
Applied to files:
cmd/theme/show.go
📚 Learning: 2025-11-10T03:03:31.505Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 0
File: :0-0
Timestamp: 2025-11-10T03:03:31.505Z
Learning: In the Atmos codebase, commands using the `StandardParser` flag pattern (from pkg/flags) do NOT need explicit `viper.BindPFlag()` calls in their code. The StandardParser encapsulates flag binding internally: flags are registered via `parser.RegisterFlags(cmd)` in init(), and bound via `parser.BindFlagsToViper(cmd, v)` in RunE, which internally calls viper.BindPFlag for each flag. This pattern is used throughout Atmos (e.g., cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/path.go). Do not flag missing viper.BindPFlag calls when StandardParser is used.
Applied to files:
pkg/flags/interactive_test.gopkg/flags/options.gopkg/flags/standard.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/tui/utils/utils.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
internal/tui/utils/utils.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
pkg/flags/positional_args_builder.gopkg/flags/standard.go
📚 Learning: 2024-11-16T17:30:52.893Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Applied to files:
pkg/flags/options.gopkg/flags/standard.gopkg/flags/interactive.godocs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-10-13T18:13:54.020Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1622
File: pkg/perf/perf.go:140-184
Timestamp: 2025-10-13T18:13:54.020Z
Learning: In pkg/perf/perf.go, the `trackWithSimpleStack` function intentionally skips ownership checks at call stack depth > 1 to avoid expensive `getGoroutineID()` calls on every nested function. This is a performance optimization for the common single-goroutine execution case (most Atmos commands), accepting the rare edge case of potential metric corruption if multi-goroutine execution occurs at depth > 1. The ~19× performance improvement justifies this trade-off.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
pkg/flags/options.go.claude/agents/flag-handler.md
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-08-16T23:33:07.477Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:651-652
Timestamp: 2025-08-16T23:33:07.477Z
Learning: In the cloudposse/atmos Go codebase, ExecuteDescribeDependents expects a pointer to AtmosConfiguration (*schema.AtmosConfiguration), so when calling it with a value returned by cfg.InitCliConfig (which returns schema.AtmosConfiguration), the address-of operator (&) is necessary: ExecuteDescribeDependents(&atmosConfig, ...).
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-08-16T23:32:40.412Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:455-456
Timestamp: 2025-08-16T23:32:40.412Z
Learning: In the cloudposse/atmos Go codebase, `InitCliConfig` returns a `schema.AtmosConfiguration` value (not a pointer), while `ExecuteDescribeDependents` expects a `*schema.AtmosConfiguration` pointer parameter. Therefore, when passing the result of `InitCliConfig` to `ExecuteDescribeDependents`, use `&atmosConfig` to pass the address of the value.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-05-22T19:58:32.988Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected.go:122-123
Timestamp: 2025-05-22T19:58:32.988Z
Learning: The "pager" flag is defined as a PersistentFlag at the describe command level in cmd/describe.go, making it available to all subcommands including describeAffectedCmd without needing to redeclare it.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
pkg/flags/standard.godocs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-01-18T15:18:35.475Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Applied to files:
cmd/theme/theme_test.go
📚 Learning: 2025-06-07T19:28:21.289Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
docs/developing-atmos-commands.md
📚 Learning: 2025-11-07T14:52:55.217Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.217Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.
Applied to files:
docs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
docs/developing-atmos-commands.md.claude/agents/flag-handler.md
📚 Learning: 2024-12-12T17:13:53.409Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 848
File: pkg/utils/doc_utils.go:19-22
Timestamp: 2024-12-12T17:13:53.409Z
Learning: In `pkg/utils/doc_utils.go`, the `DisplayDocs` function uses the `PAGER` environment variable, which is intentionally user-configurable to allow users to specify custom pager commands that fit their workflow; adding validation to restrict it is not desired.
Applied to files:
.claude/agents/flag-handler.md
🧬 Code graph analysis (9)
pkg/flags/global_builder.go (1)
pkg/flags/options.go (2)
WithBoolFlag(63-74)WithEnvVars(233-256)
pkg/ui/theme/styles.go (1)
pkg/ui/theme/scheme.go (1)
ColorScheme(7-54)
cmd/theme/show.go (8)
pkg/perf/perf.go (1)
Track(121-138)pkg/ui/theme/registry.go (1)
NewRegistry(22-47)pkg/flags/positional_args_builder.go (2)
NewPositionalArgsBuilder(57-63)PositionalArgSpec(24-31)errors/builder.go (1)
Build(21-23)pkg/flags/standard.go (1)
NewStandardFlagParser(60-84)pkg/flags/options.go (1)
WithPositionalArgPrompt(406-418)errors/errors.go (1)
ErrInvalidPositionalArgs(72-72)errors/exit_code.go (1)
WithExitCode(40-48)
pkg/flags/interactive_test.go (6)
pkg/flags/parser.go (2)
GetBool(141-150)ParsedConfig(68-90)pkg/flags/interactive.go (4)
PromptForValue(45-77)PromptForMissingRequired(88-102)PromptForOptionalValue(120-139)PromptForPositionalArg(151-163)pkg/flags/standard.go (1)
NewStandardFlagParser(60-84)pkg/flags/options.go (3)
WithOptionalValuePrompt(367-386)WithCompletionPrompt(337-349)WithPositionalArgPrompt(406-418)pkg/flags/positional_args_builder.go (2)
NewPositionalArgsBuilder(57-63)PositionalArgSpec(24-31)pkg/flags/types.go (1)
CompletionFunc(21-21)
internal/tui/utils/utils.go (2)
pkg/ui/theme/theme.go (1)
Theme(33-56)pkg/ui/theme/styles.go (1)
GetCurrentStyles(348-373)
pkg/flags/positional_args_builder.go (2)
pkg/flags/types.go (1)
CompletionFunc(21-21)pkg/perf/perf.go (1)
Track(121-138)
pkg/flags/options.go (3)
pkg/flags/types.go (2)
CompletionFunc(21-21)StringFlag(53-62)pkg/perf/perf.go (1)
Track(121-138)pkg/config/const.go (1)
IdentityFlagSelectValue(136-136)
pkg/flags/standard.go (6)
pkg/flags/positional_args_builder.go (1)
NewPositionalArgsBuilder(57-63)pkg/flags/parser.go (1)
ParsedConfig(68-90)pkg/flags/global/flags.go (1)
Flags(30-71)pkg/config/const.go (1)
IdentityFlagSelectValue(136-136)pkg/flags/interactive.go (3)
PromptForOptionalValue(120-139)PromptForMissingRequired(88-102)PromptForPositionalArg(151-163)pkg/flags/types.go (1)
CompletionFunc(21-21)
pkg/flags/interactive.go (6)
pkg/perf/perf.go (1)
Track(121-138)internal/tui/templates/term/term_writer.go (1)
IsTTYSupportForStdin(133-135)pkg/telemetry/ci.go (1)
IsCI(81-86)errors/errors.go (2)
ErrInteractiveModeNotAvailable(543-543)ErrNoOptionsAvailable(544-544)internal/tui/utils/utils.go (1)
NewAtmosHuhTheme(99-118)pkg/flags/types.go (1)
CompletionFunc(21-21)
🪛 GitHub Actions: Tests
pkg/flags/interactive_test.go
[error] 137-137: TestPromptForPositionalArg: interactive mode not available was returned unexpectedly when not interactive.
[error] 304-304: TestStandardFlagParser_PromptForMissingPositionalArgs: interactive mode not available was returned unexpectedly when not interactive.
🪛 LanguageTool
docs/developing-atmos-commands.md
[typographical] ~873-~873: Consider using typographic quotation marks here.
Context: ...) - atmos cmd --identity=admin → Uses "admin" directly - atmos cmd → Uses empty/def...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic opening quote here.
Context: ... 2. Use descriptive prompt titles - "Choose a theme to preview" not "Select t...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic close quote here.
Context: ...pt titles** - "Choose a theme to preview" not "Select theme" 3. **Handle empty re...
(EN_QUOTES)
[typographical] ~958-~958: Consider using typographic quotation marks here.
Context: ...les** - "Choose a theme to preview" not "Select theme" 3. Handle empty results gracefully ...
(EN_QUOTES)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (23)
pkg/flags/global_builder.go (1)
103-105: LGTM!The interactive flag is correctly placed in the terminal flags group and follows the established patterns for flag registration. The comment clearly describes the behavior and requirements (TTY, disabled in CI).
pkg/flags/global/flags.go (1)
46-46: LGTM!The Interactive field is appropriately placed in the Terminal and I/O configuration section with a clear comment. Defaulting to
true(line 85) provides a good user experience by enabling interactive prompts by default.pkg/flags/types.go (1)
9-21: LGTM!The CompletionFunc type alias is well-documented and provides a clean abstraction for completion functions used in both shell completion and interactive prompts. The parameter descriptions are helpful.
internal/tui/utils/utils.go (1)
97-116: LGTM!Excellent refactoring to use the centralized theme system instead of hardcoded color values. This improves consistency and allows users to customize interactive prompt colors through themes.
Based on learnings
cmd/theme/theme_test.go (1)
119-130: LGTM!The test correctly reflects the prompt-aware validation behavior. Accepting zero arguments makes sense since interactive prompts will handle the missing value, while still rejecting more than one argument. The comments clearly explain this behavior.
errors/errors.go (1)
543-544: LGTM!The new error sentinels are clearly named and appropriately placed near related interactive/TTY errors. These will provide clear error signals for the interactive prompting subsystem.
pkg/ui/theme/scheme.go (1)
42-44: LGTM!The button color additions integrate well with the ColorScheme. Using BrightWhite for button text and BrightBlue for button background provides good contrast and aligns with standard primary action button styling. These are correctly consumed by the Huh theme setup in
internal/tui/utils/utils.go.Also applies to: 104-106
docs/developing-atmos-commands.md (1)
795-971: Documentation looks good—no duplication found.Verification shows the "Interactive Prompts (Recommended)" section appears only once (at line 795), not twice as the AI summary suggested. The comprehensive content covering use cases, best practices, and error handling is solid and ready to merge.
pkg/ui/theme/styles.go (1)
72-76: Interactive style wiring looks good.The new
Interactivestyles andgetInteractiveStyleshelper cleanly tie intoColorScheme.ButtonForeground/ButtonBackgroundand are correctly hooked intoGetStyles, so the Huh prompts can rely on theme-aware button styling without changing existing behavior.Also applies to: 154-156, 249-261
cmd/theme/show.go (1)
17-33: Interactive theme selection flow looks good; just a couple of small considerations.The new
ThemesArgCompletionhelper and the switch toStandardFlagParser+ positional prompts fortheme showlook coherent: usage is derived from the builder,Parseowns positional handling, and missing theme names now get a structured error with helpful hints.Two small, optional thoughts:
ThemesArgCompletioncurrently ignorestoCompleteand always returns all theme names. That’s fine for small lists, but if the catalog grows it might be nice to filter bytoCompletefor snappier shell completion.- In
init, you’re callingthemeShowParser.BindFlagsToViper(themeShowCmd, viper.GetViper())rather than the olderBindToViperpattern shown in the flag-handling docs. IfStandardFlagParseris now meant to useBindFlagsToViperin init for commands that rely onParse, that’s totally fine—just worth double-checking this matches how other new commands are wired so we keep the pattern consistent.Overall, the interactive positional wiring for
theme showlooks solid.Also applies to: 56-81, 93-118
pkg/flags/options.go (2)
24-36: Prompt config fields and struct look well-scopedThe added
flagPrompts,optionalValuePrompts, andpositionalPromptsmaps plusflagPromptConfigkeep prompt metadata local to flag parsing and align with the StandardFlagParser wiring. Structure and naming read clearly and feel idiomatic.
388-418: Positional prompt option is cleanly designed
WithPositionalArgPromptmirrors the flag-based prompt helpers and cleanly pushes the configuration intoparserConfig. The API shape is consistent and should make wiring positional prompts straightforward.pkg/flags/interactive.go (4)
18-36: Interactive gating matches stdin/CI expectations
isInteractivelines up with prior patterns: it respects theinteractiveflag/env via Viper, requires stdin TTY (IsTTYSupportForStdin()), and disables prompts underIsCI(). This should avoid surprise prompts in pipelines while still allowing TUIs that don’t read from stdin.
38-77: Core prompt helper is robust and well-guarded
PromptForValue:
- Correctly short-circuits when interactive mode is unavailable.
- Fails fast on empty options with
ErrNoOptionsAvailable.- Wraps the Huh selector with the Atmos theme and a sane height limit.
This gives you a single, well-behaved entry point all other prompt flows can safely reuse.
79-102: Graceful fallback for missing-required prompts in non-interactive contextsFor
PromptForMissingRequired, returning""with no error when not interactive or when completions return no options feels like the right contract: the parser can attempt prompting when possible but leave ultimate validation to Cobra or higher-level logic when it isn’t. Behavior looks consistent with the doc comments.
141-163: Positional-arg prompting is consistent with the other helpers
PromptForPositionalArgreuses the same completion+PromptForValue pattern and passes through current args for context-aware completions. LettingPromptForValuehandle the interactive gating keeps this small and easy to reason about. No issues spotted.pkg/flags/standard.go (7)
37-49: Struct extensions cleanly isolate prompt stateAdding
flagPrompts,optionalValuePrompts, andpositionalPromptsdirectly ontoStandardFlagParserkeeps prompt concerns local to parsing without leaking into callers. Field names are descriptive and align with the three documented use cases.
63-83: ParserConfig initialization for prompt maps is solid
NewStandardFlagParsereagerly initializes the prompt maps onparserConfig, then copies them onto the parser. That avoids nil-map surprises in later logic and keeps the Options pattern working as before. The wiring looks consistent with the new Option helpers.
533-556: Skipping positional validation when prompts exist preserves interactive flowThe updated
validatePositionalArgscorrectly:
- Detects when any spec has a configured positional prompt.
- Skips the internal validator in that case, relying instead on the prompt-aware
cmd.Argsvalidator and the laterpromptForMissingPositionalArgsstep.That avoids double-validating or rejecting missing args before prompts can fill them in, while still honoring the original validator when no prompts are configured.
632-645: Prompt handling is placed at the right point in the parse pipelineRunning
handleInteractivePromptsafter populatingresult.Flagsfrom Viper but beforevalidateFlagValuesis a good choice:
- Prompts see the fully resolved values (flags/env/config/defaults).
- Any values selected interactively are then subject to the same validation path as normal CLI input.
The insertion point looks correct and shouldn’t change existing semantics when no prompts are configured.
784-807: Prompt orchestration ordering is sensible
handleInteractivePromptsprocesses:
- Optional-value flags (to resolve sentinel values early),
- Missing required flags,
- Missing positional args.
That order keeps later logic from misinterpreting sentinel values as “missing” and ensures positional prompts see the final flag state. The helper also returns immediately on any prompt failure, which matches the expectation that Ctrl-C or prompt errors should abort the command.
857-902: Missing-required flag prompts are cautious about user intent
promptForMissingRequiredFlagstakes care to:
- Only prompt when the flag’s current value is empty.
- Skip prompting if the user explicitly set the flag (even to empty) by checking
cobraFlag.Changed.- Update
result.Flagsonly when a real selection is made.That avoids overriding explicit user input and defers to normal validation when prompts are unavailable or completions yield no options. The behavior feels conservative in a good way.
904-954: Positional prompting is incremental and respects required/optional distinction
promptForMissingPositionalArgs:
- Walks positional specs in order, only touching indices beyond the current args length.
- Prompts only for required args with a configured prompt.
- Appends selected values to
result.PositionalArgsrather than overwriting existing ones.- Leaves missing required args to be caught by validation when no selection occurs.
This incremental approach should play nicely with both context-aware completions and the prompt-aware
cmd.Argsvalidator.
|
Warning Changelog Entry RequiredThis PR is labeled Action needed: Add a new blog post in Example filename: Alternatively: If this change doesn't require a changelog entry, remove the |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (14)
docs/developing-atmos-commands.md(1 hunks)pkg/flags/interactive.go(1 hunks)pkg/flags/options.go(3 hunks)tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden(1 hunks)website/blog/2025-11-18-interactive-flag-prompts.mdx(1 hunks)
🧰 Additional context used
🧠 Learnings (41)
📓 Common learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-11-07T14:52:55.217Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.217Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxdocs/developing-atmos-commands.md
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldenwebsite/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxtests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_about_--help.stdout.goldenpkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_auth_env_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2024-11-16T17:30:52.893Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.gopkg/flags/options.godocs/developing-atmos-commands.md
📚 Learning: 2024-10-21T17:51:53.976Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform.go:114-118
Timestamp: 2024-10-21T17:51:53.976Z
Learning: When `atmos terraform clean --everything` is used without specifying a component and without the `--force` flag, prompt the user for confirmation before deleting all components. Use the `--force` flag to skip the confirmation prompt.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2024-12-13T15:28:13.630Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/version.go:34-44
Timestamp: 2024-12-13T15:28:13.630Z
Learning: In `cmd/version.go`, when handling the `--check` flag in the `versionCmd`, avoid using `CheckForAtmosUpdateAndPrintMessage(cliConfig)` as it updates the cache timestamp, which may not be desired in this context.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.goldendocs/developing-atmos-commands.md
📚 Learning: 2024-11-10T18:37:10.032Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_component_utils.go:354-360
Timestamp: 2024-11-10T18:37:10.032Z
Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
pkg/flags/interactive.gopkg/flags/options.gotests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2025-01-07T20:38:09.618Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 896
File: cmd/editor_config.go:37-40
Timestamp: 2025-01-07T20:38:09.618Z
Learning: Error handling suggestion for `cmd.Help()` in `cmd/editor_config.go` was deferred as the code is planned for future modifications.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
pkg/flags/interactive.gopkg/flags/options.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
pkg/flags/interactive.gopkg/flags/options.godocs/developing-atmos-commands.md
📚 Learning: 2025-06-07T19:28:21.289Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-11-10T03:03:31.505Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 0
File: :0-0
Timestamp: 2025-11-10T03:03:31.505Z
Learning: In the Atmos codebase, commands using the `StandardParser` flag pattern (from pkg/flags) do NOT need explicit `viper.BindPFlag()` calls in their code. The StandardParser encapsulates flag binding internally: flags are registered via `parser.RegisterFlags(cmd)` in init(), and bound via `parser.BindFlagsToViper(cmd, v)` in RunE, which internally calls viper.BindPFlag for each flag. This pattern is used throughout Atmos (e.g., cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/path.go). Do not flag missing viper.BindPFlag calls when StandardParser is used.
Applied to files:
pkg/flags/options.godocs/developing-atmos-commands.md
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-02-09T14:38:53.443Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/cmd_utils.go:0-0
Timestamp: 2025-02-09T14:38:53.443Z
Learning: Error handling for RegisterFlagCompletionFunc in AddStackCompletion is not required as the errors are non-critical for tab completion functionality.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-04-04T02:03:23.676Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1185
File: internal/exec/yaml_func_store.go:26-26
Timestamp: 2025-04-04T02:03:23.676Z
Learning: The Atmos codebase currently uses `log.Fatal` for error handling in multiple places. The maintainers are aware this isn't an ideal pattern (should only be used in main() or init() functions) and plan to address it comprehensively in a separate PR. CodeRabbit should not flag these issues or push for immediate changes until that refactoring is complete.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-10-13T18:13:54.020Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1622
File: pkg/perf/perf.go:140-184
Timestamp: 2025-10-13T18:13:54.020Z
Learning: In pkg/perf/perf.go, the `trackWithSimpleStack` function intentionally skips ownership checks at call stack depth > 1 to avoid expensive `getGoroutineID()` calls on every nested function. This is a performance optimization for the common single-goroutine execution case (most Atmos commands), accepting the rare edge case of potential metric corruption if multi-goroutine execution occurs at depth > 1. The ~19× performance improvement justifies this trade-off.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.
Applied to files:
pkg/flags/options.gotests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2025-08-16T23:33:07.477Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:651-652
Timestamp: 2025-08-16T23:33:07.477Z
Learning: In the cloudposse/atmos Go codebase, ExecuteDescribeDependents expects a pointer to AtmosConfiguration (*schema.AtmosConfiguration), so when calling it with a value returned by cfg.InitCliConfig (which returns schema.AtmosConfiguration), the address-of operator (&) is necessary: ExecuteDescribeDependents(&atmosConfig, ...).
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.
Applied to files:
pkg/flags/options.gotests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2025-08-16T23:32:40.412Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:455-456
Timestamp: 2025-08-16T23:32:40.412Z
Learning: In the cloudposse/atmos Go codebase, `InitCliConfig` returns a `schema.AtmosConfiguration` value (not a pointer), while `ExecuteDescribeDependents` expects a `*schema.AtmosConfiguration` pointer parameter. Therefore, when passing the result of `InitCliConfig` to `ExecuteDescribeDependents`, use `&atmosConfig` to pass the address of the value.
Applied to files:
pkg/flags/options.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method (as of cobra v1.8.1) never returns an error. It only initializes an internal map and stores the completion function, always returning nil. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/options.go
📚 Learning: 2024-10-20T13:12:46.499Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
📚 Learning: 2024-11-22T12:38:33.132Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-22T12:38:33.132Z
Learning: In the Atmos project, continue to flag path traversal issues in code reviews but acknowledge when they are expected and acceptable in specific cases.
Applied to files:
docs/developing-atmos-commands.md
🧬 Code graph analysis (2)
pkg/flags/interactive.go (6)
pkg/perf/perf.go (1)
Track(121-138)internal/tui/templates/term/term_writer.go (1)
IsTTYSupportForStdin(133-135)pkg/telemetry/ci.go (1)
IsCI(81-86)errors/errors.go (2)
ErrInteractiveModeNotAvailable(543-543)ErrNoOptionsAvailable(544-544)internal/tui/utils/utils.go (1)
NewAtmosHuhTheme(99-118)pkg/flags/types.go (1)
CompletionFunc(21-21)
pkg/flags/options.go (2)
pkg/flags/types.go (2)
CompletionFunc(21-21)StringFlag(53-62)pkg/config/const.go (1)
IdentityFlagSelectValue(136-136)
🪛 LanguageTool
website/blog/2025-11-18-interactive-flag-prompts.mdx
[grammar] ~127-~127: Please add a punctuation mark at the end of paragraph.
Context: ...tion - atmos auth commands - Identity selection Coming soon: We're actively workin...
(PUNCTUATION_PARAGRAPH_END)
docs/developing-atmos-commands.md
[typographical] ~873-~873: Consider using typographic quotation marks here.
Context: ...) - atmos cmd --identity=admin → Uses "admin" directly - atmos cmd → Uses empty/def...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic opening quote here.
Context: ... 2. Use descriptive prompt titles - "Choose a theme to preview" not "Select t...
(EN_QUOTES)
[typographical] ~958-~958: Consider using a typographic close quote here.
Context: ...pt titles** - "Choose a theme to preview" not "Select theme" 3. **Handle empty re...
(EN_QUOTES)
[typographical] ~958-~958: Consider using typographic quotation marks here.
Context: ...les** - "Choose a theme to preview" not "Select theme" 3. Handle empty results gracefully ...
(EN_QUOTES)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Summary
🔇 Additional comments (8)
docs/developing-atmos-commands.md (1)
795-971: Excellent documentation of the interactive prompts feature.The guide is thorough and covers all the essential aspects: use cases, completion functions, graceful degradation, error handling, and best practices. The three use case examples (positional args, optional value flags, required flags) are clear and will help developers implement this feature correctly.
The static analysis hints about quotation marks are purely stylistic (straight vs. typographic quotes) and can be safely ignored—they don't affect readability or correctness.
tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden (1)
86-88: Consistent flag addition to help output.The
--interactiveflag is properly reflected in the help text with clear description of its behavior and default value.tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden (1)
86-88: LGTM!Test snapshot correctly captures the new interactive flag in the help output.
tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden (1)
98-100: Consistent update across atlantis command.The interactive flag is properly included in the repo-config help output.
tests/snapshots/TestCLICommands_atmos_auth_exec_--help.stdout.golden (1)
49-51: Auth exec command properly inherits the interactive flag.tests/snapshots/TestCLICommands_atmos_auth_validate_--help.stdout.golden (1)
51-53: Flag properly included in auth validate help.tests/snapshots/TestCLICommands_atmos_auth_whoami_--help.stdout.golden (1)
51-53: Consistent with other auth subcommands.tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden (1)
98-100: Help output correctly updated for --help variant.The snapshots for both
helpand--helpinvocations are consistent.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (3)
tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden (1)
55-58: Same--interactivehelp text as previous snapshotFeedback is the same as in
TestCLICommands_atmos_atlantis_generate_help.stdout.golden: consider updating the shared flag description so it also mentions positional arguments/optional prompts.tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden (1)
58-61: Same--interactivehelp text as other Atlantis snapshotsThis uses the same description as the other Atlantis help snapshots; the earlier suggestion about mentioning positional arguments/optional prompts in the shared flag definition applies here too.
tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden (1)
49-51: Keep--interactivewording consistent across auth helpOnce you settle on the final phrasing for
--interactive(e.g., clarifying flags vs positional args), make sure this snapshot stays in lockstep with the configure help so users see a consistent description everywhere.
🧹 Nitpick comments (2)
tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden (1)
55-58: Consider clarifying that prompts also cover positional arguments and optional valuesRight now the
--interactivehelp only mentions “missing required flags”, but the PR also enables prompts for positional arguments and optional sentinel-valued flags; you might want to broaden the wording (in the shared global flag definition so all snapshots regenerate) to avoid under-describing the feature.tests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.golden (1)
49-51: Consider broadening--interactivehelp text to match behaviorNice addition. Since interactive mode in this PR also covers optional sentinel-valued flags and missing positional arguments, you might tweak the wording so it doesn’t sound limited to “missing required flags” only (e.g., “missing required values (flags or positional arguments)”).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.golden(1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
tests/snapshots/TestCLICommands_atmos_auth_user_configure_--help.stdout.goldentests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: Summary
tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden
Outdated
Show resolved
Hide resolved
…ands This commit adds extensive tests to increase code coverage: - pkg/flags/standard_test.go: Added tests for ParseWithPositionalArgs, ValidatePositionalArgs, GetViperKey, Reset, IsFlagExplicitlyChanged, IsValueValid, CreateValidationError, ValidateFlagValues, GetStringFlagValue - pkg/flags/options_test.go: Added tests for WithStringSliceFlag, WithRequiredStringFlag, WithIdentityFlag, WithCommonFlags, WithViperPrefix, WithValidValues, WithEnvVars for all flag types (string, bool, int, slice) - cmd/theme/theme_test.go: Added TestThemesArgCompletion for shell completion and TestExecuteThemeShowMissingArgs for missing positional args handling - internal/tui/utils/utils_test.go: Added TestNewAtmosHuhTheme to verify Huh theme creation with proper styling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@coderabbitai full review please |
|
@aknysh I'll conduct a full review of all the changes in this PR. 🧠 Learnings used✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/tui/utils/utils_test.go (1)
449-480: Optional: reduce duplication with a single theme instance + table-driven checks.Right now each subtest calls
NewAtmosHuhTheme()again; it’s fine, but you can make this tighter and more idiomatic by creating onehuhThemeand checking a small table of assertions.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
cmd/theme/theme_test.go(3 hunks)internal/tui/utils/utils_test.go(1 hunks)pkg/flags/options_test.go(1 hunks)pkg/flags/standard_test.go(1 hunks)tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.golden(1 hunks)tests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- cmd/theme/theme_test.go
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: Comment style: All comments must end with periods (enforced bygodotlinter)
Import organization: Three groups separated by blank lines (stdlib, 3rd-party, Atmos packages), sorted alphabetically within groups, maintain aliases:cfg,log,u,errUtils
Performance tracking: Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions. Usenilif no atmosConfig param
Error handling: ALL user-facing errors MUST use ErrorBuilder with sentinel errors fromerrors/errors.go. ALWAYS useerrors.Is()for checking, NEVER string comparison. ALWAYS useassert.ErrorIs()in tests, NEVERassert.Contains(err.Error(), ...)
Mock generation: Usego.uber.org/mock/mockgenwith//go:generatedirectives. Never manual mocks
File organization: Keep files small and focused (<600 lines). One cmd/impl per file. Co-locate tests. Never use `//revive:disable:file-lengt...
Files:
internal/tui/utils/utils_test.gopkg/flags/standard_test.gopkg/flags/options_test.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
**/*_test.go: Test skipping conventions: Uset.Skipf("reason")with clear context. CLI tests auto-build temp binaries
Golden snapshots: NEVER manually edit golden snapshot files - Always use-regenerate-snapshotsflag. Snapshots capture exact output including invisible formatting (lipgloss padding, ANSI codes, trailing whitespace). Different environments produce different output. Never use pipe redirection (2>&1,| head,| tail) when running tests as piping breaks TTY detection
Files:
internal/tui/utils/utils_test.gopkg/flags/standard_test.gopkg/flags/options_test.go
🧠 Learnings (34)
📓 Common learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:34.794Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Pull requests: Follow template (what/why/references). PRs labeled `minor`/`major` MUST include blog post: `website/blog/YYYY-MM-DD-feature-name.mdx`. Use `.mdx` with YAML front matter, `<!--truncate-->` after intro. MUST read `website/blog/tags.yml` - only use defined tags, never invent. MUST read `website/blog/authors.yml` - use existing author or add new. Valid tags: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core. Use `no-release` label for docs-only changes
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Adding new CLI command: 1) Create `cmd/[command]/` with CommandProvider interface, 2) Add blank import to `cmd/root.go`: `_ "github.com/cloudposse/atmos/cmd/mycommand"`, 3) Implement in `internal/exec/mycommand.go`, 4) Add tests in `cmd/mycommand/mycommand_test.go`, 5) Create Docusaurus docs in `website/docs/cli/commands/<command>/<subcommand>.mdx`, 6) Build website: `cd website && npm run build`. See `docs/developing-atmos-commands.md` and `docs/prd/command-registry-pattern.md`
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.goldenpkg/flags/options_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Adding new CLI command: 1) Create `cmd/[command]/` with CommandProvider interface, 2) Add blank import to `cmd/root.go`: `_ "github.com/cloudposse/atmos/cmd/mycommand"`, 3) Implement in `internal/exec/mycommand.go`, 4) Add tests in `cmd/mycommand/mycommand_test.go`, 5) Create Docusaurus docs in `website/docs/cli/commands/<command>/<subcommand>.mdx`, 6) Build website: `cd website && npm run build`. See `docs/developing-atmos-commands.md` and `docs/prd/command-registry-pattern.md`
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.goldentests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.golden
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.
Applied to files:
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldentests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden
📚 Learning: 2025-12-13T03:21:27.620Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:27.620Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.goldenpkg/flags/options_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Theme: Use colors from `pkg/ui/theme/colors.go`
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Applied to files:
internal/tui/utils/utils_test.gopkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-05-23T19:51:47.091Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios in Go
Applied to files:
internal/tui/utils/utils_test.gopkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Performance tracking: Add `defer perf.Track(atmosConfig, "pkg.FuncName")()` + blank line to all public functions. Use `nil` if no atmosConfig param
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-10T03:03:31.505Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 0
File: :0-0
Timestamp: 2025-11-10T03:03:31.505Z
Learning: In the Atmos codebase, commands using the `StandardParser` flag pattern (from pkg/flags) do NOT need explicit `viper.BindPFlag()` calls in their code. The StandardParser encapsulates flag binding internally: flags are registered via `parser.RegisterFlags(cmd)` in init(), and bound via `parser.BindFlagsToViper(cmd, v)` in RunE, which internally calls viper.BindPFlag for each flag. This pattern is used throughout Atmos (e.g., cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/path.go). Do not flag missing viper.BindPFlag calls when StandardParser is used.
Applied to files:
pkg/flags/standard_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to cmd/*/*.go : Flag handling: Commands MUST use `flags.NewStandardParser()` for command-specific flags. NEVER call `viper.BindEnv()` or `viper.BindPFlag()` directly (enforced by Forbidigo linter)
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Provide comprehensive help text for all commands and flags, include examples in command help, and follow Go's documentation conventions in Cobra command definitions
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Testing strategy: Prefer unit tests with mocks over integration tests. Use interfaces + dependency injection for testability. Generate mocks with `go.uber.org/mock/mockgen`. Use table-driven tests for comprehensive coverage. Integration tests in `tests/` only when necessary. Target >80% coverage
Applied to files:
pkg/flags/standard_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Test quality: Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests - don't test hardcoded stubs return hardcoded values. Make code testable - use DI to avoid `os.Exit`, `CheckErrorPrintAndExit`, external systems. No coverage theater - validate real behavior. Remove always-skipped tests - fix or delete. Table-driven tests need real scenarios. Use `assert.ErrorIs(err, ErrSentinel)` for our/stdlib errors. String matching OK for third-party errors
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to cmd/**/*_test.go : Testing: Use `cmd.NewTestKit(t)` for cmd tests to auto-clean RootCmd state (flags, args)
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-12-13T04:37:40.435Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: cmd/toolchain/get.go:23-40
Timestamp: 2025-12-13T04:37:40.435Z
Learning: In cmd/toolchain/get.go, the get subcommand intentionally uses cobra.MaximumNArgs(1) so it works with zero args (list all tools) or one arg (a specific tool). Flags are defined via flags.NewStandardParser() with --all (bool) and --limit (int); no direct viper.BindEnv/BindPFlag calls are used.
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Use Viper for managing configuration, environment variables, and flags in CLI commands
Applied to files:
pkg/flags/standard_test.gopkg/flags/options_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to cmd/**/*_test.go : Test isolation: ALWAYS use `cmd.NewTestKit(t)` for cmd tests to auto-clean RootCmd state (flags, args). Required for any test touching RootCmd
Applied to files:
pkg/flags/options_test.go
🧬 Code graph analysis (2)
internal/tui/utils/utils_test.go (1)
internal/tui/utils/utils.go (1)
NewAtmosHuhTheme(166-185)
pkg/flags/options_test.go (2)
pkg/flags/options.go (10)
WithStringSliceFlag(101-112)WithRequiredStringFlag(115-127)WithIdentityFlag(137-146)WithCommonFlags(173-190)WithViperPrefix(302-308)WithStringFlag(49-60)WithValidValues(284-294)WithNoOptDefVal(265-275)WithEnvVars(233-256)WithIntFlag(77-88)pkg/flags/types.go (4)
StringSliceFlag(246-253)StringFlag(53-62)BoolFlag(122-128)IntFlag(180-187)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
🔇 Additional comments (5)
tests/snapshots/TestCLICommands_config_alias_tr_--help_shows_terraform_help.stdout.golden (1)
268-271: Snapshot update for new--interactiveglobal flag looks consistent.This change aligns with the feature’s help-text expectations; just make sure snapshot tests are stable across environments (line wrapping / spacing can be finicky in Cobra help output).
tests/snapshots/TestCLICommands_config_alias_tp_--help_shows_terraform_plan_help.stdout.golden (1)
86-89:--interactiveinclusion interraform plan --helpsnapshot is coherent and matches other help output.Please double-check this doesn’t depend on terminal width (to avoid wrapping diffs on different runners).
pkg/flags/options_test.go (1)
170-345: Excellent test coverage for flag helper functions!These new tests comprehensively cover the flag helper constructors and configuration functions. They properly test both success paths and edge cases (non-existent flags), use appropriate assertions, and maintain good isolation. The tests validate behavior across different flag types (string, bool, int, string slice) and configuration options (env vars, valid values, etc.).
pkg/flags/standard_test.go (1)
178-743: Comprehensive test suite for StandardFlagParser!These tests provide excellent coverage of the StandardFlagParser functionality, including the new positional args and prompt-aware features. The tests are well-structured with clear subtests, proper use of table-driven patterns where appropriate, and comprehensive edge case coverage (nil commands, empty args, nested paths, validation failures). Good use of require/assert and proper test isolation throughout.
tests/snapshots/TestCLICommands_atmos_--help_config_aliases_section.stdout.golden (1)
76-79: Help text wording: clarify "(requires TTY)" to specify stdin requirement for prompting.The interactive prompting feature checks
IsTTYSupportForStdin(), not just any TTY. The current wording "(requires TTY, disabled in CI)" is vague. Consider rephrasing to "(requires stdin TTY for prompts, disabled in CI)" or similar to avoid confusion about which TTY stream is needed.⛔ Skipped due to learnings
Learnt from: osterman Repo: cloudposse/atmos PR: 1599 File: internal/exec/terraform.go:0-0 Timestamp: 2025-10-11T19:11:58.965Z Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.Learnt from: osterman Repo: cloudposse/atmos PR: 768 File: internal/exec/vendor_component_utils.go:354-360 Timestamp: 2024-11-10T18:37:10.032Z Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.Learnt from: osterman Repo: cloudposse/atmos PR: 1599 File: internal/exec/terraform.go:394-402 Timestamp: 2025-10-10T23:51:36.597Z Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.Learnt from: samtholiya Repo: cloudposse/atmos PR: 1068 File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0 Timestamp: 2025-02-19T05:50:35.853Z Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.Learnt from: CR Repo: cloudposse/atmos PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-13T00:52:18.278Z Learning: Applies to **/*_test.go : Golden snapshots: NEVER manually edit golden snapshot files - Always use `-regenerate-snapshots` flag. Snapshots capture exact output including invisible formatting (lipgloss padding, ANSI codes, trailing whitespace). Different environments produce different output. Never use pipe redirection (`2>&1`, `| head`, `| tail`) when running tests as piping breaks TTY detectionLearnt from: osterman Repo: cloudposse/atmos PR: 768 File: website/docs/cheatsheets/vendoring.mdx:70-70 Timestamp: 2024-11-12T13:06:56.194Z Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.Learnt from: RoseSecurity Repo: cloudposse/atmos PR: 1448 File: cmd/ansible.go:26-28 Timestamp: 2025-09-05T14:57:37.360Z Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.Learnt from: Listener430 Repo: cloudposse/atmos PR: 825 File: internal/exec/helmfile_generate_varfile.go:28-31 Timestamp: 2024-12-07T16:16:13.038Z Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.Learnt from: samtholiya Repo: cloudposse/atmos PR: 959 File: cmd/describe_config.go:20-20 Timestamp: 2025-02-03T06:00:11.419Z Learning: The `describe config` command should use `PrintErrorMarkdownAndExit` with empty title and suggestion for consistency with other commands.Learnt from: samtholiya Repo: cloudposse/atmos PR: 955 File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0 Timestamp: 2025-01-19T15:49:15.593Z Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
|
@aknysh I'll conduct a full review of all the changes in this PR. 🧠 Learnings used✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/flags/standard.go (1)
549-574: Parse() can return success with missing required positional args (when prompting can’t fill).
Right now, if positional prompts exist,validatePositionalArgsskips validation (Lines 554-572), andpromptForMissingPositionalArgsreturns nil even when it couldn’t fill (selectedValue == ""), leaving missing required args undetected insideParse(). This is especially risky ifParse()is used outside Cobra execution paths.One straightforward fix: after attempting prompts, run the original positional validator and return its error if args are still invalid.
func (p *StandardFlagParser) Parse(ctx context.Context, args []string) (*ParsedConfig, error) { @@ - // Step 2: Validate positional args if configured. - if err := p.validatePositionalArgs(result.PositionalArgs); err != nil { - return nil, err - } - - // Step 3: Populate Flags map from Viper with precedence applied. + // Step 2: Populate Flags map from Viper with precedence applied. p.populateFlagsFromViper(result, combinedFlags) - // Step 3.5: Handle interactive prompts (all 3 use cases). + // Step 3: Handle interactive prompts (all 3 use cases). if err := p.handleInteractivePrompts(result, combinedFlags); err != nil { return nil, err } - // Step 4: Validate flag values against valid values constraints. + // Step 4: Validate positional args after prompting (so prompts can fill missing required args). + if err := p.validatePositionalArgs(result.PositionalArgs); err != nil { + return nil, err + } + + // Step 5: Validate flag values against valid values constraints. if combinedFlags != nil { if err := p.validateFlagValues(result.Flags, combinedFlags); err != nil { return nil, err } }…and then simplify
validatePositionalArgsto always callp.positionalArgs.validatorwhen present (no “skip if prompts exist” special case).Also applies to: 920-970
♻️ Duplicate comments (1)
docs/developing-atmos-commands.md (1)
833-833: Correct the constructor name.Line 833 uses
flags.NewStandardFlagParserbut the correct constructor name isflags.NewStandardParser(without "Flag" in the name). This matches the actual API used throughout the codebase.Apply this diff:
- themeShowParser = flags.NewStandardFlagParser( + themeShowParser = flags.NewStandardParser(
🧹 Nitpick comments (3)
internal/tui/utils/utils_test.go (1)
450-480: Current assertions may be non-meaningful if fields are structs (not pointers).Consider asserting on observable behavior (e.g., compare
Render()output againsthuh.ThemeCharm()for the same token, or assert specific foreground/background values when the theme is known in-test).pkg/flags/interactive_test.go (1)
699-721: TTY/CI behavior test is pragmatic.Line 719's assertion
assert.IsType(t, true, result || !result, ...)is a bit unusual - it essentially just confirms the result is boolean. Consider simplifying to just call the function without the tautological assertion:t.Run("returns value based on TTY and CI when interactive is enabled", func(t *testing.T) { viper.Set("interactive", true) // In test environment, this typically returns false (no TTY or CI detected). // We just verify the function executes without panic. - result := isInteractive() - // Result depends on actual environment, but should be boolean. - assert.IsType(t, true, result || !result, "should return boolean") + _ = isInteractive() + // Result depends on actual environment; just verify no panic. })pkg/flags/standard.go (1)
800-823: Prompt order is nondeterministic due to map iteration.
optionalValuePromptsandflagPromptsare iterated as maps, so prompt order can vary run-to-run. If multiple prompts can fire in one command, consider sorting keys for stable UX and less flaky tests.Also applies to: 873-918
…ands This commit adds extensive tests to increase code coverage: - pkg/flags/standard_test.go: Added tests for ParseWithPositionalArgs, ValidatePositionalArgs, GetViperKey, Reset, IsFlagExplicitlyChanged, IsValueValid, CreateValidationError, ValidateFlagValues, GetStringFlagValue - pkg/flags/options_test.go: Added tests for WithStringSliceFlag, WithRequiredStringFlag, WithIdentityFlag, WithCommonFlags, WithViperPrefix, WithValidValues, WithEnvVars for all flag types (string, bool, int, slice) - cmd/theme/theme_test.go: Added TestThemesArgCompletion for shell completion and TestExecuteThemeShowMissingArgs for missing positional args handling - internal/tui/utils/utils_test.go: Added TestNewAtmosHuhTheme to verify Huh theme creation with proper styling (refactored to table-driven style) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
internal/tui/utils/utils_test.go (1)
449-480: Struct assertions don't validate theme-driven colors.These
assert.NotNilchecks ontheme.Focused,theme.Blurred, and nested style fields will always pass because Go structs can't be nil. They don't prove thatNewAtmosHuhThemeactually applies colors fromtheme.GetCurrentStyles(). Consider asserting on specific color values instead (e.g., comparehuhTheme.Focused.SelectSelector.GetForeground()to expected theme colors).Based on past review feedback, update the tests to check actual configured color values rather than non-nil struct presence.
🧹 Nitpick comments (3)
pkg/flags/types.go (1)
9-22: Tighten the doc comment (periods) + consider a true alias if that’s the intent.
A few of the bullet lines don’t end with periods, which can tripgodot. Also, the comment says “type alias”, but this is a new named type (fine—just make wording consistent).// Parameters: -// - cmd: The cobra command being completed -// - args: Positional arguments provided so far -// - toComplete: Partial string being completed +// - cmd: The cobra command being completed. +// - args: Positional arguments provided so far. +// - toComplete: Partial string being completed.-// CompletionFunc is a type alias for Cobra's ValidArgsFunction. +// CompletionFunc is a function type compatible with Cobra's ValidArgsFunction.If you do want a Go type-alias (to guarantee it never diverges from Cobra), please first verify your cobra version’s
cobra.ValidArgsFunctionsignature matches, then consider:-type CompletionFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) +type CompletionFunc = cobra.ValidArgsFunctioncmd/theme/show.go (1)
84-88: Consider logging the Viper binding error.Silent suppression with
_ = errloses diagnostic info. A debug-level log would help troubleshoot binding issues without failing init.if err := themeShowParser.BindFlagsToViper(themeShowCmd, viper.GetViper()); err != nil { - // Log error but don't fail initialization. - // This allows the command to still work even if Viper binding fails. - _ = err + // Log error but don't fail initialization. + // This allows the command to still work even if Viper binding fails. + log.Debug("Failed to bind flags to viper", "error", err) }pkg/flags/interactive_test.go (1)
713-720: Simplify the boolean type assertion.The assertion
assert.IsType(t, true, result || !result, ...)is convoluted. Sinceresultis already a bool, the type is guaranteed. The comment states "should return boolean" butisInteractive()returnsboolby signature.t.Run("returns value based on TTY and CI when interactive is enabled", func(t *testing.T) { viper.Set("interactive", true) // In test environment, this typically returns false (no TTY or CI detected). // We just verify the function executes without panic. - result := isInteractive() - // Result depends on actual environment, but should be boolean. - assert.IsType(t, true, result || !result, "should return boolean") + _ = isInteractive() // Just verify no panic; result depends on environment. })
…s' into osterman/interactive-flag-prompts
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
website/blog/2025-11-18-interactive-flag-prompts.mdx (1)
93-121: Consider documenting selector filtering UX (“/”, case-sensitive).Given the PR explicitly tests and documents “/” filtering and its case-sensitivity, adding a short note here would reduce surprise for readers.
pkg/flags/standard.go (1)
154-189: Only setcmd.Argswhen interactive prompts are configured. The docstring indicates the function should set a "prompt-aware Args validator" only when "prompts exist," but the current code unconditionally overwritescmd.Argseven whenhasPromptsis false. When no prompts are configured, the returned standard validator is equivalent to not settingcmd.Argsat all, and unconditionally overwriting it risks overriding pre-existing command validators.- // Generate and set the prompt-aware validator - validator := builder.GeneratePromptAwareValidator(hasPrompts) - cmd.Args = validator + if hasPrompts { + validator := builder.GeneratePromptAwareValidator(true) + cmd.Args = validator + }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (8)
internal/tui/utils/utils.go(2 hunks)internal/tui/utils/utils_test.go(2 hunks)pkg/flags/interactive.go(1 hunks)pkg/flags/interactive_test.go(1 hunks)pkg/flags/standard.go(9 hunks)pkg/flags/standard_test.go(1 hunks)pkg/flags/types.go(1 hunks)website/blog/2025-11-18-interactive-flag-prompts.mdx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- internal/tui/utils/utils.go
- pkg/flags/interactive_test.go
- pkg/flags/standard_test.go
- pkg/flags/types.go
🧰 Additional context used
📓 Path-based instructions (4)
website/**
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
website/**: Update website documentation in thewebsite/directory when adding new features, ensure consistency between CLI help text and website documentation, and follow the website's documentation structure and style
Keep website code in thewebsite/directory, follow the existing website architecture and style, and test website changes locally before committing
Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
website/blog/*.mdx
📄 CodeRabbit inference engine (CLAUDE.md)
Blog posts: Use
.mdxformat with YAML front matter inwebsite/blog/YYYY-MM-DD-feature-name.mdx. Include<!--truncate-->after intro. Use only tags defined inwebsite/blog/tags.yml. Use authors fromwebsite/blog/authors.yml
Files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*.go: Use Viper for managing configuration, environment variables, and flags in CLI commands
Use interfaces for external dependencies to facilitate mocking and consider using testify/mock for creating mock implementations
All code must pass golangci-lint checks
Follow Go's error handling idioms: use meaningful error messages, wrap errors with context usingfmt.Errorf("context: %w", err), and consider using custom error types for domain-specific errors
Follow standard Go coding style: usegofmtandgoimportsto format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Document all exported functions, types, and methods following Go's documentation conventions
Document complex logic with inline comments in Go code
Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Provide clear error messages to users, include troubleshooting hints when appropriate, and log detailed errors for debugging
**/*.go: Comment style: All comments must end with periods (enforced bygodotlinter)
Import organization: Three groups separated by blank lines (stdlib, 3rd-party, Atmos packages), sorted alphabetically within groups, maintain aliases:cfg,log,u,errUtils
Performance tracking: Adddefer perf.Track(atmosConfig, "pkg.FuncName")()+ blank line to all public functions. Usenilif no atmosConfig param
Error handling: ALL user-facing errors MUST use ErrorBuilder with sentinel errors fromerrors/errors.go. ALWAYS useerrors.Is()for checking, NEVER string comparison. ALWAYS useassert.ErrorIs()in tests, NEVERassert.Contains(err.Error(), ...)
Mock generation: Usego.uber.org/mock/mockgenwith//go:generatedirectives. Never manual mocks
File organization: Keep files small and focused (<600 lines). One cmd/impl per file. Co-locate tests. Never use `//revive:disable:file-lengt...
Files:
internal/tui/utils/utils_test.gopkg/flags/interactive.gopkg/flags/standard.go
**/*_test.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
**/*_test.go: Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Use table-driven tests for testing multiple scenarios in Go
Include integration tests for command flows and test CLI end-to-end when possible with test fixtures
**/*_test.go: Test skipping conventions: Uset.Skipf("reason")with clear context. CLI tests auto-build temp binaries
Golden snapshots: NEVER manually edit golden snapshot files - Always use-regenerate-snapshotsflag. Snapshots capture exact output including invisible formatting (lipgloss padding, ANSI codes, trailing whitespace). Different environments produce different output. Never use pipe redirection (2>&1,| head,| tail) when running tests as piping breaks TTY detection
Files:
internal/tui/utils/utils_test.go
🧠 Learnings (60)
📓 Common learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:34.794Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to website/docs/cli/commands/**/*.mdx : Documentation requirements: CLI command docs MUST include: 1) Frontmatter (title, sidebar_label, sidebar_class_name, id, description), 2) Intro component, 3) Screengrab, 4) Usage section with shell code block, 5) Arguments/Flags using `<dl><dt>` and `<dd>`, 6) Examples section. File location: `website/docs/cli/commands/<command>/<subcommand>.mdx`
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Documentation (MANDATORY): All cmds/flags need Docusaurus docs in `website/docs/cli/commands/`. Use `<dl>` for args/flags. Build: `cd website && npm run build`. Verify links by finding doc file, checking slug in frontmatter, verifying existing links. Never use command name vs. filename or guess URLs
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.go
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Pull requests: Follow template (what/why/references). PRs labeled `minor`/`major` MUST include blog post: `website/blog/YYYY-MM-DD-feature-name.mdx`. Use `.mdx` with YAML front matter, `<!--truncate-->` after intro. MUST read `website/blog/tags.yml` - only use defined tags, never invent. MUST read `website/blog/authors.yml` - use existing author or add new. Valid tags: feature, enhancement, bugfix, dx, breaking-change, security, documentation, deprecation, core. Use `no-release` label for docs-only changes
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Adding new CLI command: 1) Create `cmd/[command]/` with CommandProvider interface, 2) Add blank import to `cmd/root.go`: `_ "github.com/cloudposse/atmos/cmd/mycommand"`, 3) Implement in `internal/exec/mycommand.go`, 4) Add tests in `cmd/mycommand/mycommand_test.go`, 5) Create Docusaurus docs in `website/docs/cli/commands/<command>/<subcommand>.mdx`, 6) Build website: `cd website && npm run build`. See `docs/developing-atmos-commands.md` and `docs/prd/command-registry-pattern.md`
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.go
📚 Learning: 2025-12-13T06:07:34.794Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: docs/prd/tool-dependencies-integration.md:58-64
Timestamp: 2025-12-13T06:07:34.794Z
Learning: cloudposse/atmos: For PRD docs (docs/prd/*.md), markdownlint issues like MD040/MD010/MD034 can be handled in a separate documentation cleanup commit and should not block the current PR.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to website/** : Keep CLI documentation and website documentation in sync and document new features on the website with examples and use cases
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-02-18T13:13:11.497Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-02-18T13:13:11.497Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `<component>`) rather than converted to backticks or other markdown formatting.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to website/blog/*.mdx : Blog posts: Use `.mdx` format with YAML front matter in `website/blog/YYYY-MM-DD-feature-name.mdx`. Include `<!--truncate-->` after intro. Use only tags defined in `website/blog/tags.yml`. Use authors from `website/blog/authors.yml`
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.go
📚 Learning: 2024-11-12T13:06:56.194Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: website/docs/cheatsheets/vendoring.mdx:70-70
Timestamp: 2024-11-12T13:06:56.194Z
Learning: In `atmos vendor pull --everything`, the `--everything` flag uses the TTY for TUI but is not interactive.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.go
📚 Learning: 2025-12-13T03:21:27.620Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1813
File: cmd/terraform/shell.go:28-73
Timestamp: 2025-12-13T03:21:27.620Z
Learning: In Atmos, when calling cfg.InitCliConfig, you must first populate the schema.ConfigAndStacksInfo struct with global flag values using flags.ParseGlobalFlags(cmd, v) rather than passing an empty struct. The LoadConfig function (pkg/config/load.go) reads config selection fields (AtmosConfigFilesFromArg, AtmosConfigDirsFromArg, BasePath, ProfilesFromArg) directly from the ConfigAndStacksInfo struct, NOT from Viper. Passing an empty struct causes config selection flags (--base-path, --config, --config-path, --profile) to be silently ignored. Correct pattern: parse flags → populate struct → call InitCliConfig. See cmd/terraform/plan_diff.go for reference implementation.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2024-11-16T17:30:52.893Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdxpkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-11-07T14:52:55.217Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.217Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.
Applied to files:
website/blog/2025-11-18-interactive-flag-prompts.mdx
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Theme: Use colors from `pkg/ui/theme/colors.go`
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests targeting >80% code coverage for all packages
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Performance tracking: Add `defer perf.Track(atmosConfig, "pkg.FuncName")()` + blank line to all public functions. Use `nil` if no atmosConfig param
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-05-23T19:51:47.091Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2024-10-31T19:25:41.298Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:233-235
Timestamp: 2024-10-31T19:25:41.298Z
Learning: When specifying color values in functions like `confirmDeleteTerraformLocal` in `internal/exec/terraform_clean.go`, avoid hardcoding color values. Instead, use predefined color constants or allow customization through configuration settings to improve accessibility and user experience across different terminals and themes.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Test quality: Test behavior, not implementation. Never test stub functions - implement or remove. Avoid tautological tests - don't test hardcoded stubs return hardcoded values. Make code testable - use DI to avoid `os.Exit`, `CheckErrorPrintAndExit`, external systems. No coverage theater - validate real behavior. Remove always-skipped tests - fix or delete. Table-driven tests need real scenarios. Use `assert.ErrorIs(err, ErrSentinel)` for our/stdlib errors. String matching OK for third-party errors
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-11T03:47:45.878Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/add_test.go:67-77
Timestamp: 2025-11-11T03:47:45.878Z
Learning: In the cloudposse/atmos codebase, tests should prefer t.Setenv for environment variable setup/teardown instead of os.Setenv/Unsetenv to ensure test-scoped isolation.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-10T23:23:39.771Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/registry/aqua/aqua_test.go:417-442
Timestamp: 2025-11-10T23:23:39.771Z
Learning: In Atmos toolchain AquaRegistry, tests should not hit real GitHub. Use the options pattern via WithGitHubBaseURL to inject an httptest server URL and make GetLatestVersion/GetAvailableVersions deterministic.
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
internal/tui/utils/utils_test.gopkg/flags/interactive.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Testing strategy: Prefer unit tests with mocks over integration tests. Use interfaces + dependency injection for testability. Generate mocks with `go.uber.org/mock/mockgen`. Use table-driven tests for comprehensive coverage. Integration tests in `tests/` only when necessary. Target >80% coverage
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*_test.go : Use table-driven tests for testing multiple scenarios in Go
Applied to files:
internal/tui/utils/utils_test.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Provide meaningful feedback to users and include progress indicators for long-running operations in CLI commands
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Provide comprehensive help text for all commands and flags, include examples in command help, and follow Go's documentation conventions in Cobra command definitions
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Use Viper for managing configuration, environment variables, and flags in CLI commands
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to cmd/*/*.go : Flag handling: Commands MUST use `flags.NewStandardParser()` for command-specific flags. NEVER call `viper.BindEnv()` or `viper.BindPFlag()` directly (enforced by Forbidigo linter)
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Support configuration via files, environment variables, and flags following the precedence order: flags > environment variables > config file > defaults
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2024-11-10T18:37:10.032Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_component_utils.go:354-360
Timestamp: 2024-11-10T18:37:10.032Z
Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Follow standard Go coding style: use `gofmt` and `goimports` to format code, prefer short descriptive variable names, use kebab-case for command-line flags, and snake_case for environment variables
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2024-12-07T16:19:01.683Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 825
File: internal/exec/terraform.go:30-30
Timestamp: 2024-12-07T16:19:01.683Z
Learning: In `internal/exec/terraform.go`, skipping stack validation when help flags are present is not necessary.
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-01-07T20:38:09.618Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 896
File: cmd/editor_config.go:37-40
Timestamp: 2025-01-07T20:38:09.618Z
Learning: Error handling suggestion for `cmd.Help()` in `cmd/editor_config.go` was deferred as the code is planned for future modifications.
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Document complex logic with inline comments in Go code
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Comment preservation: NEVER delete existing comments without very strong reason. Preserve helpful comments, update to match code, refactor for clarity, add context when modifying. Only remove if factually incorrect, code removed, duplicates obvious code, or outdated TODO completed
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-02-19T05:50:35.853Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-02-19T05:50:35.853Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-12-13T00:52:18.278Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-13T00:52:18.278Z
Learning: Applies to **/*.go : Comment style: All comments must end with periods (enforced by `godot` linter)
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.
Applied to files:
pkg/flags/interactive.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-12-13T04:37:40.435Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: cmd/toolchain/get.go:23-40
Timestamp: 2025-12-13T04:37:40.435Z
Learning: In cmd/toolchain/get.go, the get subcommand intentionally uses cobra.MaximumNArgs(1) so it works with zero args (list all tools) or one arg (a specific tool). Flags are defined via flags.NewStandardParser() with --all (bool) and --limit (int); no direct viper.BindEnv/BindPFlag calls are used.
Applied to files:
pkg/flags/interactive.gopkg/flags/standard.go
📚 Learning: 2025-11-10T03:03:31.505Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 0
File: :0-0
Timestamp: 2025-11-10T03:03:31.505Z
Learning: In the Atmos codebase, commands using the `StandardParser` flag pattern (from pkg/flags) do NOT need explicit `viper.BindPFlag()` calls in their code. The StandardParser encapsulates flag binding internally: flags are registered via `parser.RegisterFlags(cmd)` in init(), and bound via `parser.BindFlagsToViper(cmd, v)` in RunE, which internally calls viper.BindPFlag for each flag. This pattern is used throughout Atmos (e.g., cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/path.go). Do not flag missing viper.BindPFlag calls when StandardParser is used.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-12-13T06:10:06.715Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: errors/errors.go:184-203
Timestamp: 2025-12-13T06:10:06.715Z
Learning: cloudposse/atmos: For toolchain work, duplicate/unused error sentinels in errors/errors.go should be cleaned up in a separate refactor PR and not block feature PRs; canonical toolchain sentinels live under toolchain/registry with re-exports in toolchain/errors.go.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-06-07T19:28:21.289Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to cmd/**/*.go : Use Cobra's recommended command structure with a root command and subcommands, implementing each command in a separate file under `cmd/` directory
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-11-24T17:35:37.209Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-11-24T17:35:37.209Z
Learning: Applies to **/*.go : Follow Go's error handling idioms: use meaningful error messages, wrap errors with context using `fmt.Errorf("context: %w", err)`, and consider using custom error types for domain-specific errors
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method (as of cobra v1.8.1) never returns an error. It only initializes an internal map and stores the completion function, always returning nil. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method never returns an error as it simply stores the completion function in an internal map. Error handling for this method call is unnecessary.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-05-22T19:58:32.988Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected.go:122-123
Timestamp: 2025-05-22T19:58:32.988Z
Learning: The "pager" flag is defined as a PersistentFlag at the describe command level in cmd/describe.go, making it available to all subcommands including describeAffectedCmd without needing to redeclare it.
Applied to files:
pkg/flags/standard.go
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.
Applied to files:
pkg/flags/standard.go
🧬 Code graph analysis (2)
internal/tui/utils/utils_test.go (2)
internal/tui/utils/utils.go (1)
NewAtmosHuhTheme(166-188)pkg/ui/theme/styles.go (1)
GetCurrentStyles(350-375)
pkg/flags/standard.go (7)
pkg/flags/registry.go (2)
FlagRegistry(17-19)NewFlagRegistry(22-28)pkg/perf/perf.go (1)
Track(121-138)pkg/flags/positional_args_builder.go (1)
NewPositionalArgsBuilder(57-63)pkg/flags/parser.go (1)
ParsedConfig(68-90)pkg/config/const.go (1)
IdentityFlagSelectValue(137-137)pkg/flags/interactive.go (4)
PromptForOptionalValue(128-147)OptionalValuePromptContext(105-112)PromptForMissingRequired(88-102)PromptForPositionalArg(159-174)pkg/flags/types.go (1)
CompletionFunc(21-21)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Summary
🔇 Additional comments (6)
internal/tui/utils/utils_test.go (1)
3-12: Import grouping/sorting looks correct.
Stdlib / third-party / Atmos imports are separated and sorted as expected.website/blog/2025-11-18-interactive-flag-prompts.mdx (2)
1-6: Frontmatter looks compliant (tags/authors/slug).
36-41: Update "Output is piped or redirected" claim — code allows piped output when stdin TTY.The blog states prompts are "automatically disabled when output is piped or redirected" (lines 88-92), but the implementation only checks stdin TTY plus CI detection. Prompts remain active if stdin is a TTY, even when stdout/stderr is piped—this is intentional design to allow users to pipe output while maintaining interactive input.
Change line 90 to clarify: "Output is piped or redirected and stdin is not a TTY" or simplify to just list the actual checks: stdin is a TTY and not in CI.
Likely an incorrect or invalid review comment.
pkg/flags/standard.go (1)
801-999: Prompt orchestration looks clean; deterministic ordering is a win.Sorting prompt keys for stable ordering and the “optional value → missing required → positional” sequence is predictable and test-friendly.
pkg/flags/interactive.go (2)
18-36: Confirm whetherisInteractive()guards all Huh rendering or only user-input prompts.The review suggests adding stdout/stderr TTY checks to
isInteractive(), which is sound in principle (interactive prompts need both input and output streams). However, learnings from PR 768 show Atmos intentionally separates stdin TTY checks (for input) from stdout TTY checks (for display). The key question is whetherisInteractive()is meant to gate:
- Only prompts requiring stdin (current implementation), or
- Both prompts and Huh rendering (which would need output TTY)
If Huh selectors are only called when
isInteractive()returns true, then adding output TTY checks here is warranted. If Huh also renders in non-interactive display contexts, the concern may not apply to this function specifically.
26-36: "Interactive" config precedence works as designed via global flag binding.
isInteractive()reads from the globalviperinstance by design because"interactive"is registered as a global flag inGlobalFlagBuilder(pkg/flags/global_builder.go), not as a command-specific flag. The flag defaults and environment variable binding (ATMOS_INTERACTIVE) are set up in the global viper before any command runs, ensuring proper precedence (CLI flag > ENV var > default) applies consistently across all commands and prompting contexts. Commands that use dedicatedviper.New()instances only do so for command-specific flags, while global flags remain in the global viper instance thatisInteractive()correctly reads from.
|
These changes were released in v1.202.0-rc.3. |
|
These changes were released in v1.203.0-test.1. |
Summary
Implements interactive prompt support for CLI commands with positional arguments. When a required positional argument is missing and interactive mode is enabled (default), users see a filterable selector instead of an error message. This significantly improves discoverability and reduces cognitive load for users.
Key Features
Test Plan
atmos theme showwithout arguments → interactive selector appearsatmos theme show draculawith argument → executes normallySummary by CodeRabbit
New Features
UI
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.